
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#ifndef NDEBUG
	#define DOUT( toprint ) printf( "\n# " toprint )        //!< Debug output, prints a plain text line preceded by #
	#define DPUT( toput , x ) printf( "\n# " toput , x )	//!< Debug put, a DOUT with a single variable inside
	#define DLN                                             //!< Debug line, doesn't exist in release ( with NDEBUG defined )
	#define DPUTCLOSURE	DOUT("=============================================================================");\
		DPUT("FILE: %s", __FILE__); \
		DPUT("COMPILATION DATE: %s", __DATE__); \
		DPUT("COMPILATION TIME: %s\n", __TIME__)//!< Put a closing statement, complete with datestamp and finename.
#else
	#define DOUT
	#define DPUT
	#define DLN if(0)
	#define DPUTCLOSURE
#endif

//////////////////////////////////////////////////////////////////////////

typedef char* list_data;
const list_data POISON = "BAD";

typedef struct elem {
	struct elem *next;
	struct elem *prev;
	list_data data;
	long int freq;
} elem;

typedef struct list {
	int len;
	struct elem *head;
} list;

//////////////////////////////////////////////////////////////////////////
elem* elem_construct();
int elem_OK(elem*);
int elem_destruct(elem*);

list* list_construct();
int list_destruct(list*);
int list_OK(list*);

void list_add(list_data , list*);
void list_deleteentry(int, list*);
elem* list_find(list_data, list*);
//////////////////////////////////////////////////////////////////////////

